//
//  ViewController.swift
//  TargetAction
//
//  Created by dayu on 15/5/29.
//  Copyright (c) 2015年 dayu. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    let button = Control();
    override func viewDidLoad() {
        super.viewDidLoad()
        
        button.setTarget(self, action: ViewController.btnOnClick, controlEvent: ControlEvent.TouchUpInside);
    }
    
    func btnOnClick() {
        println("Button was clicked");
    }

    override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
        button.performActionForControlEvent(ControlEvent.TouchUpInside);
    }


}

